<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>渐变</title>
  <style>
    .box1 {
      width: 600px;
      height: 100px;
      /* background-color: red; */
      /* 线性渐变  从一边到另一边 */
      /* background: linear-gradient(方向，颜色1，颜色2.。。。); */
      background: linear-gradient(to right, red 33.333%, green 33.3333%, green 66.666%, blue 66.666%);
    }

    .box2 {
      width: 600px;
      height: 100px;


      /* 径向渐变  从中间向四周  */
      /* background: radial-gradient(形状 大小 方向,颜色1，颜色2.。。。) */
      background: radial-gradient(circle closest-side at center, red 20%, green 20%, green 40%, blue 40%, blue 60%, yellow 60%, yellow 80%, pink 80%)
    }
  </style>
</head>

<body>
  <div class="box1"></div>

  <hr />
  <div class="box2"></div>
</body>

</html>